#ifndef SC_XML_H_INCLUDED
#define SC_XML_H_INCLUDED

#include "libxml/parser.h"

#include <string>

namespace sc {

struct xml
{
    struct rng
    {
        // Namespace
        static const xmlChar* NS;
        static const xmlChar* NS_VALUE;

        // RNG Element
        static const xmlChar* _element;
        static const xmlChar* _ref;
        static const xmlChar* _zeroOrMore;
        static const xmlChar* _optional;

        static const xmlChar* _text;
        static const xmlChar* _attribute;
        static const xmlChar* _data;
        static const xmlChar* _choice;
        static const xmlChar* _value;

        static const xmlChar* _param;

        // RNG Attributes
        static const xmlChar* _name;

        static const xmlChar* _type;

        static const xmlChar* _int;
        static const xmlChar* _integer;
        static const xmlChar* _float;
        static const xmlChar* _string;

        static const xmlChar* _minInclusive;
        static const xmlChar* _maxInclusive;
        static const xmlChar* _minExclusive;
        static const xmlChar* _maxExclusive;
        static const xmlChar* _pattern;
    };

    // SCC Element
    struct scc
    {
        static const xmlChar* _context;
        static const xmlChar* _file;
        static const xmlChar* _mmi;
        static const xmlChar* _element_label;
        static const xmlChar* _attribute_label;

        // SCC Attributes
        static const xmlChar* _title;
        static const xmlChar* _rng;
        static const xmlChar* _setup;
        static const xmlChar* _path;
        static const xmlChar* _for;
        static const xmlChar* _value;
        static const xmlChar* _default;
        static const xmlChar* _icon;
        static const xmlChar* _error;
        static const xmlChar* _help;
    };

    static
    std::string UTF8ToStr(const xmlChar* bufferUTF8)
    {
        int inLength = xmlStrlen(bufferUTF8);
        unsigned char* out = new unsigned char[inLength + 1];
        int outLength = inLength;
        int res = UTF8Toisolat1(out, &outLength, bufferUTF8, &inLength);

        std::string str;
        if (res > 0)
        {
            out[outLength] = 0;
            str = (char*) out;
        }
        delete out;
        return str;
    }
};

}; // namespace sc

#endif // SC_XML_H_INCLUDED
